package cn.zebra.dev.other.module.shopRevenue.service.impl;

import cn.zebra.dev.ibatis.plus.service.impl.ServiceImpl;
import cn.zebra.dev.ibatis.plus.utils.PageUtils;
import cn.zebra.dev.ibatis.plus.utils.Query;
import cn.zebra.dev.other.module.shopRevenue.dao.ShopRevenueDao;
import cn.zebra.dev.other.module.shopRevenue.entity.ShopRevenueEntity;
import cn.zebra.dev.other.module.shopRevenue.service.ShopRevenueService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 
 *
 * @author runnable
 */
@Service
public class ShopRevenueServiceImpl extends ServiceImpl<ShopRevenueDao, ShopRevenueEntity> implements ShopRevenueService {

    @Override
    public PageUtils<ShopRevenueEntity> findPage(Map<String, Object> params) {
        QueryWrapper<ShopRevenueEntity> wrapper = new QueryWrapper<>();
        IPage<ShopRevenueEntity> page = this.page(
                new Query<ShopRevenueEntity>(params).getPage(),
                wrapper
        );

        return new PageUtils<>(page);
    }

    @Override
    public PageUtils<ShopRevenueEntity> findPageByShopId(Map<String, Object> params) {
        QueryWrapper<ShopRevenueEntity> wrapper = new QueryWrapper<>();
        wrapper.apply("shop_id={0}",params.get("shopId"));
        IPage<ShopRevenueEntity> page = this.page(
                new Query<ShopRevenueEntity>(params).getPage(),
                wrapper
        );

        return new PageUtils<>(page);
    }

}
